
#ifndef OPERON_HEADER
#define	OPERON_HEADER

#include <stdio.h>
#include "berkeley/berkeley.h"

#ifdef	__cplusplus
extern "C" {
#endif

enum logType
	{
	WARNING,
	SEVERE,
	FATAL
	};
//forward delcaration of OperonDB_t
struct OperonDB_t;

/**
 * Operon
 */

typedef struct Operon_t {
    /** berkerleyDB environement */
    DB_ENV* dbenv;
    /** count number of databases opened */
    int count_open_databases;
    /** tell operon we opened this database, called by OperonDB */
    int openDB(struct Operon_t* operon,struct OperonDB_t* ptr);
    /** tell operon we closed this database, called by OperonDB  */
    int closeDB(struct Operon_t* operon,struct OperonDB_t* ptr);
    /** print log message */
    void log(struct Operon_t*,const char* file,int line,enum logType logtype,char * fmt,...);
} Operon, *OperonPtr;

/**
 * creates a new Operon
 * @return a new pointer on operon
 */
extern OperonPtr OperonNew();
/**
 * free an Operon
 * @param ptr the operon to free
 */
extern void OperonDelete(OperonPtr ptr);


#ifdef	__cplusplus
}
#endif

#endif	/* OPERON_HEADER */
